diff options
| author | bors <bors@rust-lang.org> | 2024-08-26 05:45:40 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-08-26 05:45:40 +0000 |
| commit | f48062e7d040579ac5705e1b36b34675000da5dd (patch) | |
| tree | 3ce73e27437a2212b0476c930ee827ad2a2b1371 /compiler/rustc_trait_selection/src | |
| parent | 3f121b9461cce02a703a0e7e450568849dfaa074 (diff) | |
| parent | d6a3aa4fc46d403d26afd085a3d0fd28c2269b94 (diff) | |
| download | rust-f48062e7d040579ac5705e1b36b34675000da5dd.tar.gz rust-f48062e7d040579ac5705e1b36b34675000da5dd.zip | |
Auto merge of #129595 - matthiaskrgr:rollup-4udn7nn, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #129288 (Use subtyping for `UnsafeFnPointer` coercion, too) - #129405 (Fixing span manipulation and indentation of the suggestion introduced by #126187) - #129518 (gitignore: ignore ICE reports regardless of directory) - #129519 (Remove redundant flags from `lower_ty_common` that can be inferred from the HIR) - #129525 (rustdoc: clean up tuple <-> primitive conversion docs) - #129526 (Use `FxHasher` on new solver unconditionally) - #129544 (Removes dead code from the compiler) - #129553 (add back test for stable-const-can-only-call-stable-const) - #129590 (Avoid taking reference of &TyKind) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_trait_selection/src')
| -rw-r--r-- | compiler/rustc_trait_selection/src/error_reporting/infer/suggest.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs | 11 |
2 files changed, 9 insertions, 4 deletions
diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/suggest.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/suggest.rs index 35f68a56d2d..ba656493d46 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/suggest.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/suggest.rs @@ -382,7 +382,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { if !expected_inner.is_fn() || !found_inner.is_fn() { return; } - match (&expected_inner.kind(), &found_inner.kind()) { + match (expected_inner.kind(), found_inner.kind()) { (ty::FnPtr(sig_tys, hdr), ty::FnDef(did, args)) => { let sig = sig_tys.with(*hdr); let expected_sig = &(self.normalize_fn_sig)(sig); diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs index 228b75cd73c..3cb95294fb6 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs @@ -4702,10 +4702,15 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { if let hir::ExprKind::Block(b, _) = body.value.kind && b.expr.is_none() { + // The span of '}' in the end of block. + let span = self.tcx.sess.source_map().end_point(b.span); sugg_spans.push(( - // The span will point to the closing curly brace `}` of the block. - b.span.shrink_to_hi().with_lo(b.span.hi() - BytePos(1)), - "\n Ok(())\n}".to_string(), + span.shrink_to_lo(), + format!( + "{}{}", + " Ok(())\n", + self.tcx.sess.source_map().indentation_before(span).unwrap_or_default(), + ), )); } err.multipart_suggestion_verbose( |
