Skip to content

Commit 3ea2c8c

Browse files
Revert "Note concrete type being coerced into object"
This reverts commit 862873d.
1 parent 54f79ba commit 3ea2c8c

32 files changed

+60
-54
lines changed

compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2216,10 +2216,9 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
22162216
err.span_note(tcx.def_span(item_def_id), &descr);
22172217
}
22182218
}
2219-
ObligationCauseCode::ObjectCastObligation(concrete_ty, object_ty) => {
2219+
ObligationCauseCode::ObjectCastObligation(_, object_ty) => {
22202220
err.note(&format!(
2221-
"required for the cast from `{}` to the object type `{}`",
2222-
self.ty_to_string(concrete_ty),
2221+
"required for the cast to the object type `{}`",
22232222
self.ty_to_string(object_ty)
22242223
));
22252224
}

src/test/ui/associated-type-bounds/assoc-type-eq-with-dyn-atb-fail.stderr

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
error[E0277]: the trait bound `String: Copy` is not satisfied
22
--> $DIR/assoc-type-eq-with-dyn-atb-fail.rs:32:18
33
|
4+
<<<<<<< HEAD
45
LL | fn func() -> Self::Out {
56
| ^^^^^^^^^ the trait `Copy` is not implemented for `String`
7+
=======
8+
LL | Box::new(AssocNoCopy)
9+
| ^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
10+
|
11+
= note: required for the cast to the object type `dyn Bar<Assoc = <AssocNoCopy as Thing>::Out::{opaque#0}>`
12+
>>>>>>> parent of 862873d20bb (Note concrete type being coerced into object)
613

714
error: aborting due to previous error
815

src/test/ui/associated-types/associated-types-eq-3.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ note: expected this to be `Bar`
4141
|
4242
LL | type A = usize;
4343
| ^^^^^
44-
= note: required for the cast from `isize` to the object type `dyn Foo<A = Bar>`
44+
= note: required for the cast to the object type `dyn Foo<A = Bar>`
4545

4646
error: aborting due to 3 previous errors
4747

src/test/ui/associated-types/associated-types-overridden-binding-2.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0271]: type mismatch resolving `<std::vec::IntoIter<u32> as Iterator>::It
44
LL | let _: &dyn I32Iterator<Item = u32> = &vec![42].into_iter();
55
| ^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32`
66
|
7-
= note: required for the cast from `std::vec::IntoIter<u32>` to the object type `dyn Iterator<Item = u32, Item = i32>`
7+
= note: required for the cast to the object type `dyn Iterator<Item = u32, Item = i32>`
88

99
error: aborting due to previous error
1010

src/test/ui/associated-types/issue-65774-1.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ note: required because of the requirements on the impl of `MyDisplay` for `&mut
2323
|
2424
LL | impl<'a, T: MyDisplay> MyDisplay for &'a mut T { }
2525
| ^^^^^^^^^ ^^^^^^^^^
26-
= note: required for the cast from `&mut T` to the object type `dyn MyDisplay`
26+
= note: required for the cast to the object type `dyn MyDisplay`
2727

2828
error: aborting due to 2 previous errors
2929

src/test/ui/associated-types/issue-65774-2.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ LL | writer.my_write(valref)
1818
| ^^^^^^ the trait `MyDisplay` is not implemented for `T`
1919
|
2020
= help: the trait `MyDisplay` is implemented for `&'a mut T`
21-
= note: required for the cast from `T` to the object type `dyn MyDisplay`
21+
= note: required for the cast to the object type `dyn MyDisplay`
2222

2323
error: aborting due to 2 previous errors
2424

src/test/ui/async-await/async-block-control-flow-static-semantics.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ error[E0271]: type mismatch resolving `<impl Future<Output = u8> as Future>::Out
3737
LL | let _: &dyn Future<Output = ()> = &block;
3838
| ^^^^^^ expected `()`, found `u8`
3939
|
40-
= note: required for the cast from `impl Future<Output = u8>` to the object type `dyn Future<Output = ()>`
40+
= note: required for the cast to the object type `dyn Future<Output = ()>`
4141

4242
error[E0308]: mismatched types
4343
--> $DIR/async-block-control-flow-static-semantics.rs:12:43
@@ -53,7 +53,7 @@ error[E0271]: type mismatch resolving `<impl Future<Output = u8> as Future>::Out
5353
LL | let _: &dyn Future<Output = ()> = &block;
5454
| ^^^^^^ expected `()`, found `u8`
5555
|
56-
= note: required for the cast from `impl Future<Output = u8>` to the object type `dyn Future<Output = ()>`
56+
= note: required for the cast to the object type `dyn Future<Output = ()>`
5757

5858
error[E0308]: mismatched types
5959
--> $DIR/async-block-control-flow-static-semantics.rs:47:44

src/test/ui/async-await/issue-86507.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ note: captured value is not `Send` because `&` references cannot be sent unless
1313
|
1414
LL | let x = x;
1515
| ^ has type `&T` which is not `Send`, because `T` is not `Sync`
16-
= note: required for the cast from `impl Future<Output = ()>` to the object type `dyn Future<Output = ()> + Send`
16+
= note: required for the cast to the object type `dyn Future<Output = ()> + Send`
1717
help: consider further restricting this bound
1818
|
1919
LL | fn bar<'me, 'async_trait, T: Send + std::marker::Sync>(x: &'me T)

src/test/ui/coercion/coerce-issue-49593-box-never-windows.nofallback.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ error[E0277]: the trait bound `(): std::error::Error` is not satisfied
44
LL | /* *mut $0 is coerced to Box<dyn Error> here */ Box::<_ /* ! */>::new(x)
55
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::error::Error` is not implemented for `()`
66
|
7-
= note: required for the cast from `()` to the object type `dyn std::error::Error`
7+
= note: required for the cast to the object type `dyn std::error::Error`
88

99
error[E0277]: the trait bound `(): std::error::Error` is not satisfied
1010
--> $DIR/coerce-issue-49593-box-never-windows.rs:23:49
1111
|
1212
LL | /* *mut $0 is coerced to *mut Error here */ raw_ptr_box::<_ /* ! */>(x)
1313
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::error::Error` is not implemented for `()`
1414
|
15-
= note: required for the cast from `()` to the object type `(dyn std::error::Error + 'static)`
15+
= note: required for the cast to the object type `(dyn std::error::Error + 'static)`
1616

1717
error: aborting due to 2 previous errors
1818

src/test/ui/coercion/coerce-issue-49593-box-never.nofallback.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ error[E0277]: the trait bound `(): std::error::Error` is not satisfied
44
LL | /* *mut $0 is coerced to Box<dyn Error> here */ Box::<_ /* ! */>::new(x)
55
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::error::Error` is not implemented for `()`
66
|
7-
= note: required for the cast from `()` to the object type `dyn std::error::Error`
7+
= note: required for the cast to the object type `dyn std::error::Error`
88

99
error[E0277]: the trait bound `(): std::error::Error` is not satisfied
1010
--> $DIR/coerce-issue-49593-box-never.rs:23:49
1111
|
1212
LL | /* *mut $0 is coerced to *mut Error here */ raw_ptr_box::<_ /* ! */>(x)
1313
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::error::Error` is not implemented for `()`
1414
|
15-
= note: required for the cast from `()` to the object type `(dyn std::error::Error + 'static)`
15+
= note: required for the cast to the object type `(dyn std::error::Error + 'static)`
1616

1717
error: aborting due to 2 previous errors
1818

0 commit comments

Comments
 (0)