Skip to content

Commit 1fad3b7

Browse files
Use mk_trait_obligation_with_new_self_ty for new suggestion
1 parent f99519b commit 1fad3b7

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/librustc_trait_selection/traits/error_reporting/suggestions.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -1892,7 +1892,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
18921892
span: Span,
18931893
) {
18941894
debug!(
1895-
"suggest_await_befor_try: obligation={:?}, span={:?}, trait_ref={:?}, trait_ref_self_ty={:?}",
1895+
"suggest_await_before_try: obligation={:?}, span={:?}, trait_ref={:?}, trait_ref_self_ty={:?}",
18961896
obligation,
18971897
span,
18981898
trait_ref,
@@ -1947,16 +1947,15 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
19471947
);
19481948

19491949
debug!(
1950-
"suggest_await_befor_try: normalized_projection_type {:?}",
1950+
"suggest_await_before_try: normalized_projection_type {:?}",
19511951
self.resolve_vars_if_possible(&normalized_ty)
19521952
);
1953-
let try_obligation = self.mk_obligation_for_def_id(
1954-
trait_ref.def_id(),
1955-
normalized_ty,
1956-
obligation.cause.clone(),
1953+
let try_obligation = self.mk_trait_obligation_with_new_self_ty(
19571954
obligation.param_env,
1955+
trait_ref,
1956+
normalized_ty,
19581957
);
1959-
debug!("suggest_await_befor_try: try_trait_obligation {:?}", try_obligation);
1958+
debug!("suggest_await_before_try: try_trait_obligation {:?}", try_obligation);
19601959
if self.predicate_may_hold(&try_obligation) && impls_future {
19611960
if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(span) {
19621961
if snippet.ends_with('?') {

0 commit comments

Comments
 (0)