Skip to content

Commit

Permalink
Move absolute path of bound into InferredBound
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Nov 29, 2022
1 parent cfa9c10 commit 6c13d6f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/bound.rs
@@ -1,4 +1,5 @@
use proc_macro2::{Ident, Span};
use proc_macro2::{Ident, Span, TokenStream};
use quote::quote_spanned;
use syn::punctuated::Punctuated;
use syn::{Token, TypeParamBound};

Expand Down Expand Up @@ -34,8 +35,9 @@ impl InferredBound {
}
}

pub fn spanned_ident(&self, span: Span) -> Ident {
Ident::new(self.as_str(), span)
pub fn spanned_path(&self, span: Span) -> TokenStream {
let ident = Ident::new(self.as_str(), span);
quote_spanned!(span=> ::core::marker::#ident)
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/expand.rs
Expand Up @@ -257,8 +257,8 @@ fn transform_sig(
where_clause.predicates.push(if assume_bound || is_local {
parse_quote_spanned!(default_span=> Self: 'async_trait)
} else {
let bound = bound.spanned_ident(default_span);
parse_quote_spanned!(default_span=> Self: ::core::marker::#bound + 'async_trait)
let bound = bound.spanned_path(default_span);
parse_quote_spanned!(default_span=> Self: #bound + 'async_trait)
});
}

Expand Down

0 comments on commit 6c13d6f

Please sign in to comment.