You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of #116497 - compiler-errors:impl-span, r=cjgillot
Extend `impl`'s `def_span` to include its where clauses
Typically, we highlight the def-span of an impl in a diagnostic due to either:
1. coherence error
2. trait evaluation cycle
3. invalid implementation of built-in trait
I find that an impl's where clauses are very often required to understanding why these errors come about, which is unfortunate since where clauses may be located on different lines and don't show up in the error. This PR expands the def-span of impls to include these where clauses.
r? cjgillot since you've touched this code a while back to make some spans shorter, but you can also reassign to wg-diagnostics or compiler if you're busy or have no strong opinions.
Copy file name to clipboardExpand all lines: tests/ui/invalid_dispatch_from_dyn_impls.stderr
+16-8
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,20 @@
1
1
error[E0378]: the trait `DispatchFromDyn` may only be implemented for structs containing the field being coerced, ZST fields with 1 byte alignment, and nothing else
2
2
--> $DIR/invalid_dispatch_from_dyn_impls.rs:10:1
3
3
|
4
-
LL | impl<T, U> DispatchFromDyn<WrapperWithExtraField<U>> for WrapperWithExtraField<T>
LL | / impl<T: ?Sized, U: ?Sized> DispatchFromDyn<HasReprC<U>> for HasReprC<T>
34
+
LL | | where
35
+
LL | | T: Unsize<U>,
36
+
| |_________________^
31
37
32
38
error[E0378]: the trait `DispatchFromDyn` may only be implemented for structs containing the field being coerced, ZST fields with 1 byte alignment, and nothing else
33
39
--> $DIR/invalid_dispatch_from_dyn_impls.rs:46:1
34
40
|
35
-
LL | impl<T: ?Sized, U: ?Sized> DispatchFromDyn<OverAligned<U>> for OverAligned<T>
0 commit comments