about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2020-06-18 14:31:15 -0700
committerEsteban Küber <esteban@kuber.com.ar>2020-06-18 14:31:15 -0700
commit40b27ff5f3828abd8d1ab951853bf70b5fbf6ed5 (patch)
tree758d1c46337e96e736cdb5aada1f33b15a147589
parentaa84b0fa376cd739e082786717cf31faaadeef66 (diff)
downloadrust-40b27ff5f3828abd8d1ab951853bf70b5fbf6ed5.tar.gz
rust-40b27ff5f3828abd8d1ab951853bf70b5fbf6ed5.zip
review comments: add comment
-rw-r--r--src/librustc_trait_selection/traits/error_reporting/mod.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/librustc_trait_selection/traits/error_reporting/mod.rs b/src/librustc_trait_selection/traits/error_reporting/mod.rs
index 33da020da8a..999357b02b1 100644
--- a/src/librustc_trait_selection/traits/error_reporting/mod.rs
+++ b/src/librustc_trait_selection/traits/error_reporting/mod.rs
@@ -1820,6 +1820,12 @@ impl<'v> Visitor<'v> for FindTypeParam {
     }
 
     fn visit_ty(&mut self, ty: &hir::Ty<'_>) {
+        // We collect the spans of all uses of the "bare" type param, like in `field: T` or
+        // `field: (T, T)` where we could make `T: ?Sized` while skipping cases that are known to be
+        // valid like `field: &'a T` or `field: *mut T` and cases that *might* have further `Sized`
+        // obligations like `Box<T>` and `Vec<T>`, but we perform no extra analysis for those cases
+        // and suggest `T: ?Sized` regardless of their obligations. This is fine because the errors
+        // in that case should make what happened clear enough.
         match ty.kind {
             hir::TyKind::Ptr(_) | hir::TyKind::Rptr(..) | hir::TyKind::TraitObject(..) => {}
             hir::TyKind::Path(hir::QPath::Resolved(None, path))