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
Original file line number Diff line number Diff line change
Expand Up @@ -6074,7 +6074,16 @@ fn point_at_assoc_type_restriction<G: EmissionGuarantee>(
let ty::ClauseKind::Projection(proj) = clause else {
return;
};
let name = tcx.item_name(proj.projection_term.def_id);
let Some(name) = tcx
.opt_rpitit_info(proj.projection_term.def_id)
.and_then(|data| match data {
ty::ImplTraitInTraitData::Trait { fn_def_id, .. } => Some(tcx.item_name(fn_def_id)),
ty::ImplTraitInTraitData::Impl { .. } => None,
})
.or_else(|| tcx.opt_item_name(proj.projection_term.def_id))
else {
return;
};
let mut predicates = generics.predicates.iter().peekable();
let mut prev: Option<(&hir::WhereBoundPredicate<'_>, Span)> = None;
while let Some(pred) = predicates.next() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Regression test for https://github.com/rust-lang/rust/issues/152887
//@ edition: 2024

#![feature(return_type_notation)]

pub trait Trait {
async fn func();
}

impl<T: Trait<func(..): Send>> Trait for T {}
//~^ ERROR not all trait items implemented, missing: `func`

fn check(_: impl Trait) {}

fn main() {
check(());
//~^ ERROR overflow evaluating the requirement
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
error[E0046]: not all trait items implemented, missing: `func`
--> $DIR/return-type-notation-where-clause-doesnt-apply.rs:10:1
|
LL | async fn func();
| ---------------- `func` from trait
...
LL | impl<T: Trait<func(..): Send>> Trait for T {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `func` in implementation

error[E0275]: overflow evaluating the requirement `impl Future<Output = ()> { <() as Trait>::func(..) } == _`
--> $DIR/return-type-notation-where-clause-doesnt-apply.rs:16:5
|
LL | check(());
| ^^^^^^^^^
|
note: required for `()` to implement `Trait`
--> $DIR/return-type-notation-where-clause-doesnt-apply.rs:10:32
|
LL | impl<T: Trait<func(..): Send>> Trait for T {}
| ---- ^^^^^ ^
| |
| unsatisfied trait bound introduced here
= note: 1 redundant requirement hidden
= note: required for `()` to implement `Trait`
note: required by a bound in `check`
--> $DIR/return-type-notation-where-clause-doesnt-apply.rs:13:18
|
LL | fn check(_: impl Trait) {}
| ^^^^^ required by this bound in `check`

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0046, E0275.
For more information about an error, try `rustc --explain E0046`.
Loading