Rebase fallout
This commit is contained in:
parent
2c0348a0d8
commit
ae24ebe710
@ -4592,7 +4592,7 @@ fn suggest_add_result_as_return_type(
|
|||||||
&self,
|
&self,
|
||||||
obligation: &PredicateObligation<'tcx>,
|
obligation: &PredicateObligation<'tcx>,
|
||||||
err: &mut Diag<'_>,
|
err: &mut Diag<'_>,
|
||||||
trait_ref: ty::PolyTraitRef<'tcx>,
|
trait_pred: ty::PolyTraitPredicate<'tcx>,
|
||||||
) {
|
) {
|
||||||
if ObligationCauseCode::QuestionMark != *obligation.cause.code().peel_derives() {
|
if ObligationCauseCode::QuestionMark != *obligation.cause.code().peel_derives() {
|
||||||
return;
|
return;
|
||||||
@ -4602,10 +4602,9 @@ fn suggest_add_result_as_return_type(
|
|||||||
if let hir::Node::Item(item) = node
|
if let hir::Node::Item(item) = node
|
||||||
&& let hir::ItemKind::Fn(sig, _, body_id) = item.kind
|
&& let hir::ItemKind::Fn(sig, _, body_id) = item.kind
|
||||||
&& let hir::FnRetTy::DefaultReturn(ret_span) = sig.decl.output
|
&& let hir::FnRetTy::DefaultReturn(ret_span) = sig.decl.output
|
||||||
&& self.tcx.is_diagnostic_item(sym::FromResidual, trait_ref.def_id())
|
&& self.tcx.is_diagnostic_item(sym::FromResidual, trait_pred.def_id())
|
||||||
&& let ty::Tuple(l) = trait_ref.skip_binder().args.type_at(0).kind()
|
&& trait_pred.skip_binder().trait_ref.args.type_at(0).is_unit()
|
||||||
&& l.len() == 0
|
&& let ty::Adt(def, _) = trait_pred.skip_binder().trait_ref.args.type_at(1).kind()
|
||||||
&& let ty::Adt(def, _) = trait_ref.skip_binder().args.type_at(1).kind()
|
|
||||||
&& self.tcx.is_diagnostic_item(sym::Result, def.did())
|
&& self.tcx.is_diagnostic_item(sym::Result, def.did())
|
||||||
{
|
{
|
||||||
let body = self.tcx.hir().body(body_id);
|
let body = self.tcx.hir().body(body_id);
|
||||||
|
@ -612,9 +612,11 @@ fn report_selection_error(
|
|||||||
&mut err,
|
&mut err,
|
||||||
leaf_trait_predicate,
|
leaf_trait_predicate,
|
||||||
);
|
);
|
||||||
self.suggest_add_result_as_return_type(&obligation,
|
self.suggest_add_result_as_return_type(
|
||||||
|
&obligation,
|
||||||
&mut err,
|
&mut err,
|
||||||
trait_ref);
|
leaf_trait_predicate,
|
||||||
|
);
|
||||||
|
|
||||||
if self.suggest_add_reference_to_arg(
|
if self.suggest_add_reference_to_arg(
|
||||||
&obligation,
|
&obligation,
|
||||||
|
@ -46,7 +46,7 @@ error[E0277]: the trait bound `impl Into<u32>: Into<impl Debug>` is not satisfie
|
|||||||
--> $DIR/nested_impl_trait.rs:6:46
|
--> $DIR/nested_impl_trait.rs:6:46
|
||||||
|
|
|
|
||||||
LL | fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x }
|
LL | fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x }
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^ the trait `From<impl Into<u32>>` is not implemented for `impl Into<u32>`, which is required by `impl Into<u32>: Into<impl Debug>`
|
| ^^^^^^^^^^^^^^^^^^^^^ the trait `From<impl Into<u32>>` is not implemented for `impl Debug`, which is required by `impl Into<u32>: Into<impl Debug>`
|
||||||
|
|
|
|
||||||
= help: the trait `Into<U>` is implemented for `T`
|
= help: the trait `Into<U>` is implemented for `T`
|
||||||
= note: required for `impl Into<u32>` to implement `Into<impl Debug>`
|
= 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
|
|||||||
--> $DIR/nested_impl_trait.rs:19:34
|
--> $DIR/nested_impl_trait.rs:19:34
|
||||||
|
|
|
|
||||||
LL | fn bad(x: impl Into<u32>) -> impl Into<impl Debug> { x }
|
LL | fn bad(x: impl Into<u32>) -> impl Into<impl Debug> { x }
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^ the trait `From<impl Into<u32>>` is not implemented for `impl Into<u32>`, which is required by `impl Into<u32>: Into<impl Debug>`
|
| ^^^^^^^^^^^^^^^^^^^^^ the trait `From<impl Into<u32>>` is not implemented for `impl Debug`, which is required by `impl Into<u32>: Into<impl Debug>`
|
||||||
|
|
|
|
||||||
= help: the trait `Into<U>` is implemented for `T`
|
= help: the trait `Into<U>` is implemented for `T`
|
||||||
= note: required for `impl Into<u32>` to implement `Into<impl Debug>`
|
= note: required for `impl Into<u32>` to implement `Into<impl Debug>`
|
||||||
|
Loading…
Reference in New Issue
Block a user