diff options
| author | Michael Goulet <michael@errs.io> | 2023-01-03 17:19:27 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-03 17:19:27 -0800 |
| commit | 5d828d2440ed6cc4c27057fe6aa1d305f7a559cb (patch) | |
| tree | 76ba9a1dcaf4fc6e86e9b9ebd4bf65fe4fad3657 /compiler | |
| parent | dc5247bf297e3939437adb6f932775bdfa9cf458 (diff) | |
| parent | 035d854947d5899388f77f6d00fc488caad86b5c (diff) | |
| download | rust-5d828d2440ed6cc4c27057fe6aa1d305f7a559cb.tar.gz rust-5d828d2440ed6cc4c27057fe6aa1d305f7a559cb.zip | |
Rollup merge of #106353 - lukas-code:reduce-red-lines-in-my-ide, r=wesleywiser
Reduce spans for `unsafe impl` errors Because huge spans aren't great for IDEs. Prior art: https://github.com/rust-lang/rust/pull/103749
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/coherence/unsafety.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_hir_analysis/src/coherence/unsafety.rs b/compiler/rustc_hir_analysis/src/coherence/unsafety.rs index a34815b45b3..70cc15b2f8c 100644 --- a/compiler/rustc_hir_analysis/src/coherence/unsafety.rs +++ b/compiler/rustc_hir_analysis/src/coherence/unsafety.rs @@ -21,7 +21,7 @@ pub(super) fn check_item(tcx: TyCtxt<'_>, def_id: LocalDefId) { (Unsafety::Normal, None, Unsafety::Unsafe, hir::ImplPolarity::Positive) => { struct_span_err!( tcx.sess, - item.span, + tcx.def_span(def_id), E0199, "implementing the trait `{}` is not unsafe", trait_ref.print_only_trait_path() @@ -38,7 +38,7 @@ pub(super) fn check_item(tcx: TyCtxt<'_>, def_id: LocalDefId) { (Unsafety::Unsafe, _, Unsafety::Normal, hir::ImplPolarity::Positive) => { struct_span_err!( tcx.sess, - item.span, + tcx.def_span(def_id), E0200, "the trait `{}` requires an `unsafe impl` declaration", trait_ref.print_only_trait_path() @@ -61,7 +61,7 @@ pub(super) fn check_item(tcx: TyCtxt<'_>, def_id: LocalDefId) { (Unsafety::Normal, Some(attr_name), Unsafety::Normal, hir::ImplPolarity::Positive) => { struct_span_err!( tcx.sess, - item.span, + tcx.def_span(def_id), E0569, "requires an `unsafe impl` declaration due to `#[{}]` attribute", attr_name |
