about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/traits
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-09-02 04:33:58 +0000
committerMichael Goulet <michael@errs.io>2023-09-02 04:58:23 +0000
commit7a6b52bf0d29b614df0e9528798462ad8ab53d7e (patch)
tree77ff188009c1643d0e26f96e3aca2a7ff945637b /compiler/rustc_trait_selection/src/traits
parent361f8ba847af0288b1beb3b84f6b7b4d3850bb43 (diff)
downloadrust-7a6b52bf0d29b614df0e9528798462ad8ab53d7e.tar.gz
rust-7a6b52bf0d29b614df0e9528798462ad8ab53d7e.zip
RPITITs are considered object-safe, they're always on Self:Sized methods
Diffstat (limited to 'compiler/rustc_trait_selection/src/traits')
-rw-r--r--compiler/rustc_trait_selection/src/traits/select/confirmation.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs
index 8a24f96743a..f2b546c3956 100644
--- a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs
@@ -535,6 +535,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
         let assoc_types: Vec<_> = tcx
             .associated_items(trait_predicate.def_id())
             .in_definition_order()
+            // RPITITs are not checked here, since they are not (currently) object-safe
+            // and cannot be named from a non-`Self: Sized` method.
+            .filter(|item| !item.is_impl_trait_in_trait())
             .filter_map(
                 |item| if item.kind == ty::AssocKind::Type { Some(item.def_id) } else { None },
             )