Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions compiler/rustc_hir_analysis/src/collect/item_bounds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,20 +367,8 @@ pub(super) fn explicit_item_bounds_with_filter(
// a projection self type.
Some(ty::ImplTraitInTraitData::Trait { opaque_def_id, .. }) => {
let opaque_ty = tcx.hir_node_by_def_id(opaque_def_id.expect_local()).expect_opaque_ty();
let item_ty = Ty::new_projection_from_args(
tcx,
def_id.to_def_id(),
ty::GenericArgs::identity_for_item(tcx, def_id),
);
let bounds = opaque_type_bounds(
tcx,
opaque_def_id.expect_local(),
opaque_ty.bounds,
item_ty,
opaque_ty.span,
filter,
);
assert_only_contains_predicates_from(filter, bounds, item_ty);
let bounds =
associated_type_bounds(tcx, def_id, opaque_ty.bounds, opaque_ty.span, filter);
return ty::EarlyBinder::bind(bounds);
}
Some(ty::ImplTraitInTraitData::Impl { .. }) => span_bug!(
Expand Down
21 changes: 21 additions & 0 deletions tests/ui/associated-type-bounds/implied-from-self-where-clause.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Make sure that, like associated type where clauses on traits, we gather item
// bounds for RPITITs from RTN where clauses.

//@ check-pass

#![feature(return_type_notation)]

trait Foo
where
Self::method(..): Send,
{
fn method() -> impl Sized;
}

fn is_send(_: impl Send) {}

fn test<T: Foo>() {
is_send(T::method());
}

fn main() {}
Loading