mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-01 01:23:26 +00:00
Skip mentioning lang item
This commit is contained in:
parent
d05fea6ac4
commit
c9cb19d26e
@ -1622,6 +1622,15 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
) {
|
||||
let (traits::ExprItemObligation(def_id, hir_id, idx) | traits::ExprBindingObligation(def_id, _, hir_id, idx))
|
||||
= *error.obligation.cause.code().peel_derives() else { return; };
|
||||
|
||||
// Skip over mentioning async lang item
|
||||
if Some(def_id) == self.tcx.lang_items().from_generator_fn()
|
||||
&& error.obligation.cause.span.desugaring_kind()
|
||||
== Some(rustc_span::DesugaringKind::Async)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
let Some(unsubstituted_pred) =
|
||||
self.tcx.predicates_of(def_id).instantiate_identity(self.tcx).predicates.into_iter().nth(idx) else { return; };
|
||||
|
||||
|
@ -2,13 +2,10 @@ error[E0277]: the trait bound `[static generator@$DIR/async.rs:7:29: 9:2]: Gener
|
||||
--> $DIR/async.rs:7:29
|
||||
|
|
||||
LL | async fn foo(x: u32) -> u32 {
|
||||
| _____________________________-
|
||||
| _____________________________^
|
||||
LL | | x
|
||||
LL | | }
|
||||
| | ^
|
||||
| | |
|
||||
| |_the trait `Generator<ResumeTy>` is not implemented for `[static generator@$DIR/async.rs:7:29: 9:2]`
|
||||
| required by a bound introduced by this call
|
||||
| |_^ the trait `Generator<ResumeTy>` is not implemented for `[static generator@$DIR/async.rs:7:29: 9:2]`
|
||||
|
|
||||
note: required by a bound in `std::future::from_generator`
|
||||
--> $SRC_DIR/core/src/future/mod.rs:LL:COL
|
||||
@ -23,9 +20,7 @@ LL | async fn foo(x: u32) -> u32 {
|
||||
| _____________________________^
|
||||
LL | | x
|
||||
LL | | }
|
||||
| | ^ required by a bound introduced by this call
|
||||
| |_|
|
||||
|
|
||||
| |_^
|
||||
|
|
||||
note: required by a bound in `std::future::from_generator`
|
||||
--> $SRC_DIR/core/src/future/mod.rs:LL:COL
|
||||
|
Loading…
Reference in New Issue
Block a user