File tree 1 file changed +6
-0
lines changed
src/librustc_trait_selection/traits/error_reporting
1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -1820,6 +1820,12 @@ impl<'v> Visitor<'v> for FindTypeParam {
1820
1820
}
1821
1821
1822
1822
fn visit_ty ( & mut self , ty : & hir:: Ty < ' _ > ) {
1823
+ // We collect the spans of all uses of the "bare" type param, like in `field: T` or
1824
+ // `field: (T, T)` where we could make `T: ?Sized` while skipping cases that are known to be
1825
+ // valid like `field: &'a T` or `field: *mut T` and cases that *might* have further `Sized`
1826
+ // obligations like `Box<T>` and `Vec<T>`, but we perform no extra analysis for those cases
1827
+ // and suggest `T: ?Sized` regardless of their obligations. This is fine because the errors
1828
+ // in that case should make what happened clear enough.
1823
1829
match ty. kind {
1824
1830
hir:: TyKind :: Ptr ( _) | hir:: TyKind :: Rptr ( ..) | hir:: TyKind :: TraitObject ( ..) => { }
1825
1831
hir:: TyKind :: Path ( hir:: QPath :: Resolved ( None , path) )
You can’t perform that action at this time.
0 commit comments