Skip to content

Commit 40b27ff

Browse files
committed
review comments: add comment
1 parent aa84b0f commit 40b27ff

File tree

1 file changed

+6
-0
lines changed
  • src/librustc_trait_selection/traits/error_reporting

1 file changed

+6
-0
lines changed

src/librustc_trait_selection/traits/error_reporting/mod.rs

+6
Original file line numberDiff line numberDiff line change
@@ -1820,6 +1820,12 @@ impl<'v> Visitor<'v> for FindTypeParam {
18201820
}
18211821

18221822
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.
18231829
match ty.kind {
18241830
hir::TyKind::Ptr(_) | hir::TyKind::Rptr(..) | hir::TyKind::TraitObject(..) => {}
18251831
hir::TyKind::Path(hir::QPath::Resolved(None, path))

0 commit comments

Comments
 (0)