Skip to content

Commit ae24ebe

Browse files
Rebase fallout
1 parent 2c0348a commit ae24ebe

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

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

+4-5
Original file line numberDiff line numberDiff line change
@@ -4592,7 +4592,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
45924592
&self,
45934593
obligation: &PredicateObligation<'tcx>,
45944594
err: &mut Diag<'_>,
4595-
trait_ref: ty::PolyTraitRef<'tcx>,
4595+
trait_pred: ty::PolyTraitPredicate<'tcx>,
45964596
) {
45974597
if ObligationCauseCode::QuestionMark != *obligation.cause.code().peel_derives() {
45984598
return;
@@ -4602,10 +4602,9 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
46024602
if let hir::Node::Item(item) = node
46034603
&& let hir::ItemKind::Fn(sig, _, body_id) = item.kind
46044604
&& let hir::FnRetTy::DefaultReturn(ret_span) = sig.decl.output
4605-
&& self.tcx.is_diagnostic_item(sym::FromResidual, trait_ref.def_id())
4606-
&& let ty::Tuple(l) = trait_ref.skip_binder().args.type_at(0).kind()
4607-
&& l.len() == 0
4608-
&& let ty::Adt(def, _) = trait_ref.skip_binder().args.type_at(1).kind()
4605+
&& self.tcx.is_diagnostic_item(sym::FromResidual, trait_pred.def_id())
4606+
&& trait_pred.skip_binder().trait_ref.args.type_at(0).is_unit()
4607+
&& let ty::Adt(def, _) = trait_pred.skip_binder().trait_ref.args.type_at(1).kind()
46094608
&& self.tcx.is_diagnostic_item(sym::Result, def.did())
46104609
{
46114610
let body = self.tcx.hir().body(body_id);

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

+4-2
Original file line numberDiff line numberDiff line change
@@ -612,9 +612,11 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
612612
&mut err,
613613
leaf_trait_predicate,
614614
);
615-
self.suggest_add_result_as_return_type(&obligation,
615+
self.suggest_add_result_as_return_type(
616+
&obligation,
616617
&mut err,
617-
trait_ref);
618+
leaf_trait_predicate,
619+
);
618620

619621
if self.suggest_add_reference_to_arg(
620622
&obligation,

tests/ui/impl-trait/nested_impl_trait.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ error[E0277]: the trait bound `impl Into<u32>: Into<impl Debug>` is not satisfie
4646
--> $DIR/nested_impl_trait.rs:6:46
4747
|
4848
LL | fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x }
49-
| ^^^^^^^^^^^^^^^^^^^^^ the trait `From<impl Into<u32>>` is not implemented for `impl Into<u32>`, which is required by `impl Into<u32>: Into<impl Debug>`
49+
| ^^^^^^^^^^^^^^^^^^^^^ the trait `From<impl Into<u32>>` is not implemented for `impl Debug`, which is required by `impl Into<u32>: Into<impl Debug>`
5050
|
5151
= help: the trait `Into<U>` is implemented for `T`
5252
= note: required for `impl Into<u32>` to implement `Into<impl Debug>`
@@ -55,7 +55,7 @@ error[E0277]: the trait bound `impl Into<u32>: Into<impl Debug>` is not satisfie
5555
--> $DIR/nested_impl_trait.rs:19:34
5656
|
5757
LL | fn bad(x: impl Into<u32>) -> impl Into<impl Debug> { x }
58-
| ^^^^^^^^^^^^^^^^^^^^^ the trait `From<impl Into<u32>>` is not implemented for `impl Into<u32>`, which is required by `impl Into<u32>: Into<impl Debug>`
58+
| ^^^^^^^^^^^^^^^^^^^^^ the trait `From<impl Into<u32>>` is not implemented for `impl Debug`, which is required by `impl Into<u32>: Into<impl Debug>`
5959
|
6060
= help: the trait `Into<U>` is implemented for `T`
6161
= note: required for `impl Into<u32>` to implement `Into<impl Debug>`

0 commit comments

Comments
 (0)