Skip to content

Commit d72a67f

Browse files
authored
Rollup merge of rust-lang#51104 - zackmdavis:dynamo, r=nikomatsakis
add `dyn ` to display of dynamic (trait) types ~~I'm not sure we want the `dyn` in the E0277 "trait bound [...] is not satisfied" messages ("bound" sounds like a different thing in contrast to the names of specific trait-object types like `Box<dyn Trait>`), but I'm finding the code I would need to change that hard to follow—the [display object seems to](https://github.com/rust-lang/rust/blob/f0805a4421449bd6fe3096d63820fbebe2bfcd1d/src/librustc/traits/error_reporting.rs#L600) be a [`Predicate::Trait`](https://github.com/rust-lang/rust/blob/f0805a4421449bd6fe3096d63820fbebe2bfcd1d/src/librustc/ty/mod.rs#L962) variant, whose [`Display` implementation](https://github.com/rust-lang/rust/blob/f0805a4421449bd6fe3096d63820fbebe2bfcd1d/src/librustc/util/ppaux.rs#L1309) calls `.print` on its `PolyTraitPredicate` member, [which is a type alias](https://github.com/rust-lang/rust/blob/f0805a4421449bd6fe3096d63820fbebe2bfcd1d/src/librustc/ty/mod.rs#L1112) for `ty::Binder<TraitPredicate<'tcx>>`, whose [`Display` implementation](https://github.com/rust-lang/rust/blob/f0805a4421449bd6fe3096d63820fbebe2bfcd1d/src/librustc/util/ppaux.rs#L975-L985) ... _&c._— so maybe it's time to pull-request this and see what reviewers think.~~ Resolves rust-lang#49277 (?). r? @nikomatsakis
2 parents 773ce53 + 4b18085 commit d72a67f

File tree

57 files changed

+143
-139
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+143
-139
lines changed

src/librustc/util/ppaux.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -1062,10 +1062,14 @@ define_print! {
10621062
TyParam(ref param_ty) => write!(f, "{}", param_ty),
10631063
TyAdt(def, substs) => cx.parameterized(f, substs, def.did, &[]),
10641064
TyDynamic(data, r) => {
1065-
data.print(f, cx)?;
10661065
let r = r.print_to_string(cx);
10671066
if !r.is_empty() {
1068-
write!(f, " + {}", r)
1067+
write!(f, "(")?;
1068+
}
1069+
write!(f, "dyn ")?;
1070+
data.print(f, cx)?;
1071+
if !r.is_empty() {
1072+
write!(f, " + {})", r)
10691073
} else {
10701074
Ok(())
10711075
}

src/test/compile-fail/cross-borrow-trait.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ impl Trait for Foo {}
1818
pub fn main() {
1919
let x: Box<Trait> = Box::new(Foo);
2020
let _y: &Trait = x; //~ ERROR E0308
21-
//~| expected type `&Trait`
22-
//~| found type `std::boxed::Box<Trait>`
21+
//~| expected type `&dyn Trait`
22+
//~| found type `std::boxed::Box<dyn Trait>`
2323
}

src/test/compile-fail/destructure-trait-ref.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,23 @@ fn main() {
3333
let &&x = &&(&1isize as &T);
3434

3535
// n == m
36-
let &x = &1isize as &T; //~ ERROR type `&T` cannot be dereferenced
37-
let &&x = &(&1isize as &T); //~ ERROR type `&T` cannot be dereferenced
38-
let box x = box 1isize as Box<T>; //~ ERROR type `std::boxed::Box<T>` cannot be dereferenced
36+
let &x = &1isize as &T; //~ ERROR type `&dyn T` cannot be dereferenced
37+
let &&x = &(&1isize as &T); //~ ERROR type `&dyn T` cannot be dereferenced
38+
let box x = box 1isize as Box<T>; //~ ERROR type `std::boxed::Box<dyn T>` cannot be dereferenced
3939

4040
// n > m
4141
let &&x = &1isize as &T;
4242
//~^ ERROR mismatched types
43-
//~| expected type `T`
43+
//~| expected type `dyn T`
4444
//~| found type `&_`
4545
//~| expected trait T, found reference
4646
let &&&x = &(&1isize as &T);
4747
//~^ ERROR mismatched types
48-
//~| expected type `T`
48+
//~| expected type `dyn T`
4949
//~| found type `&_`
5050
//~| expected trait T, found reference
5151
let box box x = box 1isize as Box<T>;
5252
//~^ ERROR mismatched types
53-
//~| expected type `T`
53+
//~| expected type `dyn T`
5454
//~| found type `std::boxed::Box<_>`
5555
}

src/test/compile-fail/dst-bad-assign-3.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub fn main() {
4242
let z: Box<ToBar> = Box::new(Bar1 {f: 36});
4343
f5.2 = Bar1 {f: 36};
4444
//~^ ERROR mismatched types
45-
//~| expected type `ToBar`
45+
//~| expected type `dyn ToBar`
4646
//~| found type `Bar1`
4747
//~| expected trait ToBar, found struct `Bar1`
4848
//~| ERROR the size for value values of type

src/test/compile-fail/dst-bad-assign.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub fn main() {
4444
let z: Box<ToBar> = Box::new(Bar1 {f: 36});
4545
f5.ptr = Bar1 {f: 36};
4646
//~^ ERROR mismatched types
47-
//~| expected type `ToBar`
47+
//~| expected type `dyn ToBar`
4848
//~| found type `Bar1`
4949
//~| expected trait ToBar, found struct `Bar1`
5050
//~| ERROR the size for value values of type

src/test/compile-fail/fn-trait-formatting.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ fn main() {
1616
let _: () = (box |_: isize| {}) as Box<FnOnce(isize)>;
1717
//~^ ERROR mismatched types
1818
//~| expected type `()`
19-
//~| found type `std::boxed::Box<std::ops::FnOnce(isize)>`
19+
//~| found type `std::boxed::Box<dyn std::ops::FnOnce(isize)>`
2020
let _: () = (box |_: isize, isize| {}) as Box<Fn(isize, isize)>;
2121
//~^ ERROR mismatched types
2222
//~| expected type `()`
23-
//~| found type `std::boxed::Box<std::ops::Fn(isize, isize)>`
23+
//~| found type `std::boxed::Box<dyn std::ops::Fn(isize, isize)>`
2424
let _: () = (box || -> isize { unimplemented!() }) as Box<FnMut() -> isize>;
2525
//~^ ERROR mismatched types
2626
//~| expected type `()`
27-
//~| found type `std::boxed::Box<std::ops::FnMut() -> isize>`
27+
//~| found type `std::boxed::Box<dyn std::ops::FnMut() -> isize>`
2828

2929
needs_fn(1);
3030
//~^ ERROR : std::ops::Fn<(isize,)>`

src/test/compile-fail/issue-13033.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ struct Baz;
1717
impl Foo for Baz {
1818
fn bar(&mut self, other: &Foo) {}
1919
//~^ ERROR method `bar` has an incompatible type for trait
20-
//~| expected type `fn(&mut Baz, &mut Foo)`
21-
//~| found type `fn(&mut Baz, &Foo)`
20+
//~| expected type `fn(&mut Baz, &mut dyn Foo)`
21+
//~| found type `fn(&mut Baz, &dyn Foo)`
2222
}
2323

2424
fn main() {}

src/test/compile-fail/issue-20939.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
trait Foo {}
1212

1313
impl<'a> Foo for Foo+'a {}
14-
//~^ ERROR the object type `Foo + 'a` automatically implements the trait `Foo`
14+
//~^ ERROR the object type `(dyn Foo + 'a)` automatically implements the trait `Foo`
1515

1616
fn main() {}

src/test/compile-fail/issue-32963.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ fn size_of_copy<T: Copy+?Sized>() -> usize { mem::size_of::<T>() }
1717
fn main() {
1818
size_of_copy::<Misc+Copy>();
1919
//~^ ERROR only auto traits can be used as additional traits in a trait object
20-
//~| ERROR the trait bound `Misc: std::marker::Copy` is not satisfied
20+
//~| ERROR the trait bound `dyn Misc: std::marker::Copy` is not satisfied
2121
}

src/test/compile-fail/issue-41139.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ fn get_function<'a>() -> &'a Fn() -> Trait { panic!("") }
1414

1515
fn main() {
1616
let t : &Trait = &get_function()();
17-
//~^ ERROR cannot move a value of type Trait + 'static
17+
//~^ ERROR cannot move a value of type (dyn Trait + 'static)
1818
}

src/test/compile-fail/issue-5153.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ impl Foo for isize {
1818

1919
fn main() {
2020
(&5isize as &Foo).foo();
21-
//~^ ERROR: no method named `foo` found for type `&Foo` in the current scope
21+
//~^ ERROR: no method named `foo` found for type `&dyn Foo` in the current scope
2222
}

src/test/compile-fail/kindck-send-object.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ trait Message : Send { }
2020

2121
fn object_ref_with_static_bound_not_ok() {
2222
assert_send::<&'static (Dummy+'static)>();
23-
//~^ ERROR `Dummy + 'static` cannot be shared between threads safely [E0277]
23+
//~^ ERROR `(dyn Dummy + 'static)` cannot be shared between threads safely [E0277]
2424
}
2525

2626
fn box_object_with_no_bound_not_ok<'a>() {
2727
assert_send::<Box<Dummy>>();
28-
//~^ ERROR `Dummy` cannot be sent between threads safely
28+
//~^ ERROR `dyn Dummy` cannot be sent between threads safely
2929
}
3030

3131
fn object_with_send_bound_ok() {

src/test/compile-fail/kindck-send-object1.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ trait Dummy { }
1818
// careful with object types, who knows what they close over...
1919
fn test51<'a>() {
2020
assert_send::<&'a Dummy>();
21-
//~^ ERROR `Dummy + 'a` cannot be shared between threads safely [E0277]
21+
//~^ ERROR `(dyn Dummy + 'a)` cannot be shared between threads safely [E0277]
2222
}
2323
fn test52<'a>() {
2424
assert_send::<&'a (Dummy+Sync)>();
@@ -37,7 +37,7 @@ fn test61() {
3737
// them not ok
3838
fn test_71<'a>() {
3939
assert_send::<Box<Dummy+'a>>();
40-
//~^ ERROR `Dummy + 'a` cannot be sent between threads safely
40+
//~^ ERROR `(dyn Dummy + 'a)` cannot be sent between threads safely
4141
}
4242

4343
fn main() { }

src/test/compile-fail/kindck-send-object2.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ trait Dummy { }
1515

1616
fn test50() {
1717
assert_send::<&'static Dummy>();
18-
//~^ ERROR `Dummy + 'static` cannot be shared between threads safely [E0277]
18+
//~^ ERROR `(dyn Dummy + 'static)` cannot be shared between threads safely [E0277]
1919
}
2020

2121
fn test53() {
2222
assert_send::<Box<Dummy>>();
23-
//~^ ERROR `Dummy` cannot be sent between threads safely
23+
//~^ ERROR `dyn Dummy` cannot be sent between threads safely
2424
}
2525

2626
// ...unless they are properly bounded

src/test/compile-fail/map-types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ fn main() {
2525
let x: Box<HashMap<isize, isize>> = box HashMap::new();
2626
let x: Box<Map<isize, isize>> = x;
2727
let y: Box<Map<usize, isize>> = Box::new(x);
28-
//~^ ERROR `std::boxed::Box<Map<isize, isize>>: Map<usize, isize>` is not satisfied
28+
//~^ ERROR `std::boxed::Box<dyn Map<isize, isize>>: Map<usize, isize>` is not satisfied
2929
}

src/test/compile-fail/non-interger-atomic.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -61,22 +61,22 @@ pub unsafe fn test_Foo_cxchg(p: &mut Foo, v: Foo) {
6161

6262
pub unsafe fn test_Bar_load(p: &mut Bar, v: Bar) {
6363
intrinsics::atomic_load(p);
64-
//~^ ERROR expected basic integer type, found `&std::ops::Fn()`
64+
//~^ ERROR expected basic integer type, found `&dyn std::ops::Fn()`
6565
}
6666

6767
pub unsafe fn test_Bar_store(p: &mut Bar, v: Bar) {
6868
intrinsics::atomic_store(p, v);
69-
//~^ ERROR expected basic integer type, found `&std::ops::Fn()`
69+
//~^ ERROR expected basic integer type, found `&dyn std::ops::Fn()`
7070
}
7171

7272
pub unsafe fn test_Bar_xchg(p: &mut Bar, v: Bar) {
7373
intrinsics::atomic_xchg(p, v);
74-
//~^ ERROR expected basic integer type, found `&std::ops::Fn()`
74+
//~^ ERROR expected basic integer type, found `&dyn std::ops::Fn()`
7575
}
7676

7777
pub unsafe fn test_Bar_cxchg(p: &mut Bar, v: Bar) {
7878
intrinsics::atomic_cxchg(p, v, v);
79-
//~^ ERROR expected basic integer type, found `&std::ops::Fn()`
79+
//~^ ERROR expected basic integer type, found `&dyn std::ops::Fn()`
8080
}
8181

8282
pub unsafe fn test_Quux_load(p: &mut Quux, v: Quux) {

src/test/compile-fail/object-does-not-impl-trait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@
1414
trait Foo {}
1515
fn take_foo<F:Foo>(f: F) {}
1616
fn take_object(f: Box<Foo>) { take_foo(f); }
17-
//~^ ERROR `std::boxed::Box<Foo>: Foo` is not satisfied
17+
//~^ ERROR `std::boxed::Box<dyn Foo>: Foo` is not satisfied
1818
fn main() {}

src/test/compile-fail/object-safety-by-value-self-use.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ trait Baz {
2222
}
2323

2424
fn use_bar(t: Box<Bar>) {
25-
t.bar() //~ ERROR cannot move a value of type Bar
25+
t.bar() //~ ERROR cannot move a value of type (dyn Bar + 'static)
2626
}
2727

2828
fn main() { }

src/test/compile-fail/privacy/associated-item-privacy-type-binding.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@ mod priv_trait {
1919

2020
pub macro mac1() {
2121
let _: Box<PubTr<AssocTy = u8>>;
22-
//~^ ERROR type `priv_trait::PubTr<AssocTy=u8> + '<empty>` is private
23-
//~| ERROR type `priv_trait::PubTr<AssocTy=u8> + '<empty>` is private
22+
//~^ ERROR type `(dyn priv_trait::PubTr<AssocTy=u8> + '<empty>)` is private
23+
//~| ERROR type `(dyn priv_trait::PubTr<AssocTy=u8> + '<empty>)` is private
2424
type InSignatureTy2 = Box<PubTr<AssocTy = u8>>;
25-
//~^ ERROR type `priv_trait::PubTr<AssocTy=u8> + 'static` is private
25+
//~^ ERROR type `(dyn priv_trait::PubTr<AssocTy=u8> + 'static)` is private
2626
trait InSignatureTr2: PubTr<AssocTy = u8> {}
2727
//~^ ERROR trait `priv_trait::PrivTr` is private
2828
}
2929
pub macro mac2() {
3030
let _: Box<PrivTr<AssocTy = u8>>;
31-
//~^ ERROR type `priv_trait::PrivTr<AssocTy=u8> + '<empty>` is private
32-
//~| ERROR type `priv_trait::PrivTr<AssocTy=u8> + '<empty>` is private
31+
//~^ ERROR type `(dyn priv_trait::PrivTr<AssocTy=u8> + '<empty>)` is private
32+
//~| ERROR type `(dyn priv_trait::PrivTr<AssocTy=u8> + '<empty>)` is private
3333
type InSignatureTy1 = Box<PrivTr<AssocTy = u8>>;
34-
//~^ ERROR type `priv_trait::PrivTr<AssocTy=u8> + 'static` is private
34+
//~^ ERROR type `(dyn priv_trait::PrivTr<AssocTy=u8> + 'static)` is private
3535
trait InSignatureTr1: PrivTr<AssocTy = u8> {}
3636
//~^ ERROR trait `priv_trait::PrivTr` is private
3737
}

src/test/compile-fail/private-inferred-type.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ fn main() {
129129
m::leak_anon2(); //~ ERROR type `m::Priv` is private
130130
m::leak_anon3(); //~ ERROR type `m::Priv` is private
131131

132-
m::leak_dyn1(); //~ ERROR type `m::Trait + 'static` is private
132+
m::leak_dyn1(); //~ ERROR type `(dyn m::Trait + 'static)` is private
133133
m::leak_dyn2(); //~ ERROR type `m::Priv` is private
134134
m::leak_dyn3(); //~ ERROR type `m::Priv` is private
135135

src/test/compile-fail/trait-item-privacy.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ fn check_assoc_const() {
110110
// A, B, C are resolved as inherent items, their traits don't need to be in scope
111111
C::A; //~ ERROR associated constant `A` is private
112112
//~^ ERROR the trait `assoc_const::C` cannot be made into an object
113-
//~| ERROR the trait bound `assoc_const::C: assoc_const::A` is not satisfied
113+
//~| ERROR the trait bound `dyn assoc_const::C: assoc_const::A` is not satisfied
114114
C::B; // ERROR the trait `assoc_const::C` cannot be made into an object
115-
//~^ ERROR the trait bound `assoc_const::C: assoc_const::B` is not satisfied
115+
//~^ ERROR the trait bound `dyn assoc_const::C: assoc_const::B` is not satisfied
116116
C::C; // OK
117117
}
118118

src/test/compile-fail/traits-repeated-supertrait-ambig.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ impl CompareTo<u64> for i64 {
3333
impl CompareToInts for i64 { }
3434

3535
fn with_obj(c: &CompareToInts) -> bool {
36-
c.same_as(22) //~ ERROR `CompareToInts: CompareTo<i32>` is not satisfied
36+
c.same_as(22) //~ ERROR `dyn CompareToInts: CompareTo<i32>` is not satisfied
3737
}
3838

3939
fn with_trait<C:CompareToInts>(c: &C) -> bool {
4040
c.same_as(22) //~ ERROR `C: CompareTo<i32>` is not satisfied
4141
}
4242

4343
fn with_ufcs1<C:CompareToInts>(c: &C) -> bool {
44-
CompareToInts::same_as(c, 22) //~ ERROR `CompareToInts: CompareTo<i32>` is not satisfied
44+
CompareToInts::same_as(c, 22) //~ ERROR `dyn CompareToInts: CompareTo<i32>` is not satisfied
4545
}
4646

4747
fn with_ufcs2<C:CompareToInts>(c: &C) -> bool {

src/test/compile-fail/trivial_casts.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -59,25 +59,25 @@ pub fn main() {
5959

6060
// unsize trait
6161
let x: &Bar = &Bar;
62-
let _ = x as &Foo; //~ERROR trivial cast: `&Bar` as `&Foo`
63-
let _ = x as *const Foo; //~ERROR trivial cast: `&Bar` as `*const Foo`
62+
let _ = x as &Foo; //~ERROR trivial cast: `&Bar` as `&dyn Foo`
63+
let _ = x as *const Foo; //~ERROR trivial cast: `&Bar` as `*const dyn Foo`
6464
let _: &Foo = x;
6565
let _: *const Foo = x;
6666

6767
let x: &mut Bar = &mut Bar;
68-
let _ = x as &mut Foo; //~ERROR trivial cast: `&mut Bar` as `&mut Foo`
69-
let _ = x as *mut Foo; //~ERROR trivial cast: `&mut Bar` as `*mut Foo`
68+
let _ = x as &mut Foo; //~ERROR trivial cast: `&mut Bar` as `&mut dyn Foo`
69+
let _ = x as *mut Foo; //~ERROR trivial cast: `&mut Bar` as `*mut dyn Foo`
7070
let _: &mut Foo = x;
7171
let _: *mut Foo = x;
7272

7373
let x: Box<Bar> = Box::new(Bar);
74-
let _ = x as Box<Foo>; //~ERROR trivial cast: `std::boxed::Box<Bar>` as `std::boxed::Box<Foo>`
74+
let _ = x as Box<Foo>; //~ERROR `std::boxed::Box<Bar>` as `std::boxed::Box<dyn Foo>`
7575
let x: Box<Bar> = Box::new(Bar);
7676
let _: Box<Foo> = x;
7777

7878
// functions
7979
fn baz(_x: i32) {}
80-
let _ = &baz as &Fn(i32); //~ERROR trivial cast: `&fn(i32) {main::baz}` as `&std::ops::Fn(i32)`
80+
let _ = &baz as &Fn(i32); //~ERROR `&fn(i32) {main::baz}` as `&dyn std::ops::Fn(i32)`
8181
let _: &Fn(i32) = &baz;
8282
let x = |_x: i32| {};
8383
let _ = &x as &Fn(i32); //~ERROR trivial cast

src/test/compile-fail/type-mismatch-same-crate-name.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fn main() {
3333
//~^ ERROR mismatched types
3434
//~| Perhaps two different versions of crate `crate_a1`
3535
//~| expected trait `main::a::Bar`
36-
//~| expected type `std::boxed::Box<main::a::Bar + 'static>`
37-
//~| found type `std::boxed::Box<main::a::Bar>`
36+
//~| expected type `std::boxed::Box<(dyn main::a::Bar + 'static)>`
37+
//~| found type `std::boxed::Box<dyn main::a::Bar>`
3838
}
3939
}

src/test/compile-fail/type-parameter-defaults-referencing-Self-ppaux.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ fn main() {
2323
let x: i32 = 5;
2424
let y = x as MyAdd<i32>;
2525
//~^ ERROR E0038
26-
//~| ERROR cast to unsized type: `i32` as `MyAdd<i32>`
26+
//~| ERROR cast to unsized type: `i32` as `dyn MyAdd<i32>`
2727
}

src/test/run-pass/issue-21058.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ fn main() {
2626
std::intrinsics::type_name::<NT>(),
2727
// DST
2828
std::intrinsics::type_name::<DST>()
29-
)}, ("[u8]", "str", "std::marker::Send", "NT", "DST"));
29+
)}, ("[u8]", "str", "dyn std::marker::Send", "NT", "DST"));
3030
}

src/test/ui/anonymous-higher-ranked-lifetime.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ error[E0631]: type mismatch in closure arguments
7474
LL | g1(|_: (), _: ()| {}); //~ ERROR type mismatch
7575
| ^^ -------------- found signature of `fn((), ()) -> _`
7676
| |
77-
| expected signature of `for<'r> fn(&'r (), std::boxed::Box<for<'s> std::ops::Fn(&'s ()) + 'static>) -> _`
77+
| expected signature of `for<'r> fn(&'r (), std::boxed::Box<(dyn for<'s> std::ops::Fn(&'s ()) + 'static)>) -> _`
7878
|
7979
note: required by `g1`
8080
--> $DIR/anonymous-higher-ranked-lifetime.rs:33:1
@@ -102,7 +102,7 @@ error[E0631]: type mismatch in closure arguments
102102
LL | g3(|_: (), _: ()| {}); //~ ERROR type mismatch
103103
| ^^ -------------- found signature of `fn((), ()) -> _`
104104
| |
105-
| expected signature of `for<'s> fn(&'s (), std::boxed::Box<for<'r> std::ops::Fn(&'r ()) + 'static>) -> _`
105+
| expected signature of `for<'s> fn(&'s (), std::boxed::Box<(dyn for<'r> std::ops::Fn(&'r ()) + 'static)>) -> _`
106106
|
107107
note: required by `g3`
108108
--> $DIR/anonymous-higher-ranked-lifetime.rs:35:1
@@ -130,7 +130,7 @@ error[E0631]: type mismatch in closure arguments
130130
LL | h1(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch
131131
| ^^ ---------------------------- found signature of `fn((), (), (), ()) -> _`
132132
| |
133-
| expected signature of `for<'r, 's> fn(&'r (), std::boxed::Box<for<'t0> std::ops::Fn(&'t0 ()) + 'static>, &'s (), for<'t0, 't1> fn(&'t0 (), &'t1 ())) -> _`
133+
| expected signature of `for<'r, 's> fn(&'r (), std::boxed::Box<(dyn for<'t0> std::ops::Fn(&'t0 ()) + 'static)>, &'s (), for<'t0, 't1> fn(&'t0 (), &'t1 ())) -> _`
134134
|
135135
note: required by `h1`
136136
--> $DIR/anonymous-higher-ranked-lifetime.rs:39:1
@@ -144,7 +144,7 @@ error[E0631]: type mismatch in closure arguments
144144
LL | h2(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch
145145
| ^^ ---------------------------- found signature of `fn((), (), (), ()) -> _`
146146
| |
147-
| expected signature of `for<'r, 't0> fn(&'r (), std::boxed::Box<for<'s> std::ops::Fn(&'s ()) + 'static>, &'t0 (), for<'s, 't1> fn(&'s (), &'t1 ())) -> _`
147+
| expected signature of `for<'r, 't0> fn(&'r (), std::boxed::Box<(dyn for<'s> std::ops::Fn(&'s ()) + 'static)>, &'t0 (), for<'s, 't1> fn(&'s (), &'t1 ())) -> _`
148148
|
149149
note: required by `h2`
150150
--> $DIR/anonymous-higher-ranked-lifetime.rs:40:1

src/test/ui/arbitrary-self-types-not-object-safe.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ LL | let x = Box::new(5usize) as Box<Foo>;
1313
| ^^^^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object
1414
|
1515
= note: method `foo` has a non-standard `self` type
16-
= note: required because of the requirements on the impl of `std::ops::CoerceUnsized<std::boxed::Box<Foo>>` for `std::boxed::Box<usize>`
16+
= note: required because of the requirements on the impl of `std::ops::CoerceUnsized<std::boxed::Box<dyn Foo>>` for `std::boxed::Box<usize>`
1717

1818
error: aborting due to 2 previous errors
1919

0 commit comments

Comments
 (0)