Skip to content

Commit aba70e8

Browse files
committed
Add missing dyn keywords to tests that do not test for them
This ensures that these tests can be run on editions other than 2015
1 parent 91fad92 commit aba70e8

File tree

10 files changed

+33
-34
lines changed

10 files changed

+33
-34
lines changed

tests/ui/allocator/auxiliary/helper.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
extern crate alloc;
77
use alloc::fmt;
88

9-
pub fn work_with(p: &fmt::Debug) {
9+
pub fn work_with(p: &dyn fmt::Debug) {
1010
drop(p);
1111
}

tests/ui/coercion/retslot-cast.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![allow(warnings)]
22

3-
pub fn fail(x: Option<&(Iterator<Item=()>+Send)>)
4-
-> Option<&Iterator<Item=()>> {
3+
pub fn fail(x: Option<&(dyn Iterator<Item=()>+Send)>)
4+
-> Option<&dyn Iterator<Item=()>> {
55
// This call used to trigger an LLVM assertion because the return
66
// slot had type "Option<&Iterator>"* instead of
77
// "Option<&(Iterator+Send)>"* -- but this now yields a
@@ -13,8 +13,8 @@ pub fn fail(x: Option<&(Iterator<Item=()>+Send)>)
1313
inner(x) //~ ERROR mismatched types
1414
}
1515

16-
pub fn inner(x: Option<&(Iterator<Item=()>+Send)>)
17-
-> Option<&(Iterator<Item=()>+Send)> {
16+
pub fn inner(x: Option<&(dyn Iterator<Item=()>+Send)>)
17+
-> Option<&(dyn Iterator<Item=()>+Send)> {
1818
x
1919
}
2020

tests/ui/coercion/retslot-cast.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0308]: mismatched types
22
--> $DIR/retslot-cast.rs:13:5
33
|
4-
LL | -> Option<&Iterator<Item=()>> {
5-
| -------------------------- expected `Option<&dyn Iterator<Item = ()>>` because of return type
4+
LL | -> Option<&dyn Iterator<Item=()>> {
5+
| ------------------------------ expected `Option<&dyn Iterator<Item = ()>>` because of return type
66
...
77
LL | inner(x)
88
| ^^^^^^^^ expected trait `Iterator<Item = ()>`, found trait `Iterator<Item = ()> + Send`

tests/ui/coroutine/auxiliary/xcrate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub fn foo() -> impl Coroutine<(), Yield = (), Return = ()> {
1212
}
1313
}
1414

15-
pub fn bar<T: 'static>(t: T) -> Box<Coroutine<(), Yield = T, Return = ()> + Unpin> {
15+
pub fn bar<T: 'static>(t: T) -> Box<dyn Coroutine<(), Yield = T, Return = ()> + Unpin> {
1616
Box::new(
1717
#[coroutine]
1818
|| {

tests/ui/deprecation/deprecation-lint.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ mod cross_crate {
7171
<Foo as Trait>::trait_deprecated_text(&foo); //~ ERROR use of deprecated method `deprecation_lint::Trait::trait_deprecated_text`: text
7272
}
7373

74-
fn test_method_object(foo: &Trait) {
74+
fn test_method_object(foo: &dyn Trait) {
7575
foo.trait_deprecated(); //~ ERROR use of deprecated method `deprecation_lint::Trait::trait_deprecated`
7676
foo.trait_deprecated_text(); //~ ERROR use of deprecated method `deprecation_lint::Trait::trait_deprecated_text`: text
7777
}
@@ -299,7 +299,7 @@ mod this_crate {
299299
<Foo as Trait>::trait_deprecated_text(&foo); //~ ERROR use of deprecated method `this_crate::Trait::trait_deprecated_text`: text
300300
}
301301

302-
fn test_method_object(foo: &Trait) {
302+
fn test_method_object(foo: &dyn Trait) {
303303
foo.trait_deprecated(); //~ ERROR use of deprecated method `this_crate::Trait::trait_deprecated`
304304
foo.trait_deprecated_text(); //~ ERROR use of deprecated method `this_crate::Trait::trait_deprecated_text`: text
305305
}

tests/ui/dyn-drop/dyn-drop.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#![deny(dyn_drop)]
2-
#![allow(bare_trait_objects)]
32
fn foo(_: Box<dyn Drop>) {} //~ ERROR
43
fn bar(_: &dyn Drop) {} //~ERROR
5-
fn baz(_: *mut Drop) {} //~ ERROR
4+
fn baz(_: *mut dyn Drop) {} //~ ERROR
65
struct Foo {
76
_x: Box<dyn Drop> //~ ERROR
87
}

tests/ui/dyn-drop/dyn-drop.stderr

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: types that do not implement `Drop` can still have drop glue, consider instead using `std::mem::needs_drop` to detect whether a type is trivially dropped
2-
--> $DIR/dyn-drop.rs:3:19
2+
--> $DIR/dyn-drop.rs:2:19
33
|
44
LL | fn foo(_: Box<dyn Drop>) {}
55
| ^^^^
@@ -11,25 +11,25 @@ LL | #![deny(dyn_drop)]
1111
| ^^^^^^^^
1212

1313
error: types that do not implement `Drop` can still have drop glue, consider instead using `std::mem::needs_drop` to detect whether a type is trivially dropped
14-
--> $DIR/dyn-drop.rs:4:16
14+
--> $DIR/dyn-drop.rs:3:16
1515
|
1616
LL | fn bar(_: &dyn Drop) {}
1717
| ^^^^
1818

1919
error: types that do not implement `Drop` can still have drop glue, consider instead using `std::mem::needs_drop` to detect whether a type is trivially dropped
20-
--> $DIR/dyn-drop.rs:5:16
20+
--> $DIR/dyn-drop.rs:4:20
2121
|
22-
LL | fn baz(_: *mut Drop) {}
23-
| ^^^^
22+
LL | fn baz(_: *mut dyn Drop) {}
23+
| ^^^^
2424

2525
error: types that do not implement `Drop` can still have drop glue, consider instead using `std::mem::needs_drop` to detect whether a type is trivially dropped
26-
--> $DIR/dyn-drop.rs:7:15
26+
--> $DIR/dyn-drop.rs:6:15
2727
|
2828
LL | _x: Box<dyn Drop>
2929
| ^^^^
3030

3131
error: types that do not implement `Drop` can still have drop glue, consider instead using `std::mem::needs_drop` to detect whether a type is trivially dropped
32-
--> $DIR/dyn-drop.rs:14:16
32+
--> $DIR/dyn-drop.rs:13:16
3333
|
3434
LL | type T = dyn Drop;
3535
| ^^^^

tests/ui/error-codes/E0657.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ impl<'a> Lt<'a> for () {}
77
impl<T> Id<T> for T {}
88

99
fn free_fn_capture_hrtb_in_impl_trait()
10-
-> Box<for<'a> Id<impl Lt<'a>>>
10+
-> Box<dyn for<'a> Id<impl Lt<'a>>>
1111
//~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from `dyn` type
1212
{
1313
Box::new(())
@@ -16,7 +16,7 @@ fn free_fn_capture_hrtb_in_impl_trait()
1616
struct Foo;
1717
impl Foo {
1818
fn impl_fn_capture_hrtb_in_impl_trait()
19-
-> Box<for<'a> Id<impl Lt<'a>>>
19+
-> Box<dyn for<'a> Id<impl Lt<'a>>>
2020
//~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from `dyn` type
2121
{
2222
Box::new(())

tests/ui/error-codes/E0657.stderr

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from `dyn` type
2-
--> $DIR/E0657.rs:10:31
2+
--> $DIR/E0657.rs:10:35
33
|
4-
LL | -> Box<for<'a> Id<impl Lt<'a>>>
5-
| ^^
4+
LL | -> Box<dyn for<'a> Id<impl Lt<'a>>>
5+
| ^^
66
|
77
note: lifetime declared here
8-
--> $DIR/E0657.rs:10:16
8+
--> $DIR/E0657.rs:10:20
99
|
10-
LL | -> Box<for<'a> Id<impl Lt<'a>>>
11-
| ^^
10+
LL | -> Box<dyn for<'a> Id<impl Lt<'a>>>
11+
| ^^
1212

1313
error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from `dyn` type
14-
--> $DIR/E0657.rs:19:35
14+
--> $DIR/E0657.rs:19:39
1515
|
16-
LL | -> Box<for<'a> Id<impl Lt<'a>>>
17-
| ^^
16+
LL | -> Box<dyn for<'a> Id<impl Lt<'a>>>
17+
| ^^
1818
|
1919
note: lifetime declared here
20-
--> $DIR/E0657.rs:19:20
20+
--> $DIR/E0657.rs:19:24
2121
|
22-
LL | -> Box<for<'a> Id<impl Lt<'a>>>
23-
| ^^
22+
LL | -> Box<dyn for<'a> Id<impl Lt<'a>>>
23+
| ^^
2424

2525
error: aborting due to 2 previous errors
2626

tests/ui/intrinsics/non-integer-atomic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::intrinsics::{self, AtomicOrdering};
88

99
#[derive(Copy, Clone)]
1010
pub struct Foo(i64);
11-
pub type Bar = &'static Fn();
11+
pub type Bar = &'static dyn Fn();
1212
pub type Quux = [u8; 100];
1313

1414
pub unsafe fn test_bool_load(p: &mut bool, v: bool) {

0 commit comments

Comments
 (0)