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
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@ pollster-macro = { version = "0.1", path = "macro", optional = true }
[dev-dependencies]
futures-timer = "3.0"
tokio = { version = "1", features = ["sync"] }

[package.metadata.docs.rs]
all-features = true
targets = []
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tells docs.rs to build the default target only. pollsterss API is the same everywhere.
See https://docs.rs/about/metadata.

rustdoc-args = ["--cfg", "docsrs"]
3 changes: 3 additions & 0 deletions macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ syn = { version = "1", default-features = false, features = [

[dev-dependencies]
pollster = { path = "..", features = ["macro"] }

[package.metadata.docs.rs]
targets = []
4 changes: 4 additions & 0 deletions macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ use syn::{AttributeArgs, Error, ItemFn, Lit, Meta, MetaNameValue, NestedMeta, Re
/// my_fut.await;
/// }
/// ```
///
/// [`pollster::block_on`]: https://docs.rs/pollster/0.3.0/pollster/fn.block_on.html
#[proc_macro_attribute]
pub fn main(
attr: proc_macro::TokenStream,
Expand All @@ -46,6 +48,8 @@ pub fn main(
/// my_fut.await;
/// }
/// ```
///
/// [`pollster::block_on`]: https://docs.rs/pollster/0.3.0/pollster/fn.block_on.html
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit annoying because it needs to be kept up-to-date with version bumps.
Initially I was thinking putting this to "latest" but this is more correct in the sense that old versions won't link to new versions ...

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a little annoying... Perhaps the macro crate could be made to depend on the main crate when building for docsrs, allowing us to directly link through to it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried with dev-dependencies, but rust-lang/cargo#3475.
So not any way I know.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah well. I'm sure this is fine for now.

#[proc_macro_attribute]
pub fn test(
attr: proc_macro::TokenStream,
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![doc = include_str!("../README.md")]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
Copy link
Contributor Author

@daxpedda daxpedda Mar 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really nice because it shows the crate feature needed to use a specific API in the Rust documentation.
See rust-lang/rust#43781.


use std::{
future::Future,
Expand Down