Skip to content

Commit

Permalink
Merge pull request #261 from dtolnay/inferredbound
Browse files Browse the repository at this point in the history
Skip needlessly generating inferred bounds during ?Send
  • Loading branch information
dtolnay committed Mar 16, 2024
2 parents e68d68c + 1a01bb4 commit 2f5343c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,9 @@ fn transform_sig(
.push(parse_quote_spanned!(default_span=> 'async_trait));

if has_self {
let bounds: &[InferredBound] = if let Some(receiver) = sig.receiver() {
let bounds: &[InferredBound] = if is_local {
&[]
} else if let Some(receiver) = sig.receiver() {
match receiver.ty.as_ref() {
// self: &Self
Type::Reference(ty) if ty.mutability.is_none() => &[InferredBound::Sync],
Expand Down Expand Up @@ -275,7 +277,7 @@ fn transform_sig(
Context::Trait { supertraits, .. } => !has_default || has_bound(supertraits, bound),
Context::Impl { .. } => true,
};
if assume_bound || is_local {
if assume_bound {
None
} else {
Some(bound.spanned_path(default_span))
Expand Down

0 comments on commit 2f5343c

Please sign in to comment.